<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>fourierShift :: Functions (k-Wave)</title>
	<link rel="stylesheet" href="kwavehelpstyle.css" type="text/css">
</head>

<body>
<div class="content">

<h1>fourierShift</h1>
<p class="purpose">Resample data using a Fourier interpolant.</p>

<h2>Syntax</h2>

<pre class="codeinput">
data = fourierShift(data, shift)
data = fourierShift(data, shift, dim)
</pre>

<h2>Description</h2>
<p><code>fourierShift</code> resamples the input <code>data</code> along the dimension <code>dim</code> using a regular grid that is offset by the non-dimensional distance <code>shift</code>. The resampling is performed using a Fourier interpolant. This function can be used to shift the acoustic particle velocity recorded by the first-order simulation functions to the regular (non-staggered) temporal grid by setting <code>shift</code> to 1/2.</p>

<pre class="codeinput">
<span class="comment">% define input function</span>
dt      = pi/5;
t       = 0:dt:(2*pi - dt);
y       = cos(t);

<span class="comment">% shift by 1/2 a grid point spacing</span>
y_shift = fourierShift(y, 1/2);

<span class="comment">% calculate exact function for reference</span>
y_ref   = cos(t + dt/2);

<span class="comment">% plot comparison</span>
plot(t, y, 'k-s', t, y_shift, 'b-s', t, y_ref, 'rx');
legend('Original Function', 'Shifted Function', 'Reference', 'Location', 'north');
</pre>

<img vspace="5" hspace="5" src="images/fourierShift_01.png" style="width:560px;height:420px;" alt="">

<h2>Inputs</h2>

<table class="body">
    <tr valign="top">
        <td width = "150"><code>data</code></td>
        <td>input data</td>
    </tr>
    <tr valign="top">
        <td><code>shift</code></td>
        <td>non-dimensional shift, where 0 is no shift, 1/2 is for a staggered grid, and 1 is a full grid point</td>        
    </tr>         
</table>

<h2>Optional Inputs</h2>

<table class="body">
    <tr valign="top">
        <td width = "150"><code>dim</code></td>
        <td>dimension over which the signals vary in time (default = highest non-singleton dimension)</td>        
    </tr>         
</table>

<h2>Outputs</h2>

<table class="body">
    <tr valign="top">
        <td width = "150"><code>shifted_data</code></td>
        <td>shifted data</td>
    </tr>
</table>

<h2>See Also</h2>

<code><a href="gradientSpect.html">gradientSpect</a></code>




</div></body></html>